﻿/***********************************************************************/
/* Web Jumper Download Page class                                      */                 
/* Created          : Tan Chun Mun                                     */
/* Date             : 24 March 2008                                    */
/* Copyrighted      :                                                  */
/*****************************Description*******************************/
/*     This class is the internal class that perfrom                   */
/*     downloading web page                                            */
/*****************************Revision**********************************/
/*                                                                     */
/***********************************************************************/
using System;
using System.Net;
using System.IO;

namespace Util
{
    internal class WebDownloader
    {
        /// <summary>
        /// This is to get the web page that we want to navigate
        /// </summary>
        /// <param m_strName="URL">Page Url</param>
        /// <param m_strName="expiry">expiry time</param>
        /// <returns>The page content</returns>
        internal String GetWebPage(String URL, TimeSpan expiry)
        {
            WebClient browser = new WebClient();
            WebRequest WRAskWebSite = WebRequest.Create(URL);
            using (WebResponse WRResWebSite = WRAskWebSite.GetResponse())
            {
                using (StreamReader SR = new StreamReader(WRResWebSite.GetResponseStream(),true))
                {
                    return SR.ReadToEnd();
                }

            }

        }
       
    }
}
